<?php
defined( 'BASEPATH' ) or exit( 'No direct script access allowed' );
class Ui extends MY_Controller
{
    function __construct()
    {
        parent::__construct();
        $this->is_super = isset( $this->user['role_id'] ) && $this->user['role_id'] == '1';
        // 双语版标志
        $this->load->vars( 'is_bilingual', true );
    }
    function index()
    {
        $this->load->model( 'menu_model' );
        $this->load->vars( 'shortcut', $this->menu_model->get_shortcut() );
        
        if (! empty( $_SESSION['err_msg'] ))
        {
            $this->load->vars( 'err_msg', $_SESSION['err_msg'] );
            unset( $_SESSION['err_msg'] );
        }
        
        $this->load->view( 'master:index' );
    }
    function nav()
    {
        $this->load->view( 'master:nav' );
    }
    function focus()
    {
        $this->load->view( 'master:focus' );
    }
    function friend()
    {
        $this->load->view( 'master:friend' );
    }
    function category()
    {
        if ($this->is_super)
        {
            $this->load->view( 'master:category_super' );
        }
        else
        {
            $this->load->view( 'master:category' );
        }
    }
    function setting()
    {
        $get_uri = 'ajax/setting_handle/get';
        $modify_uri = 'ajax/setting_handle/modify';
        if ($this->is_super)
        {
            $get_uri = 'ajax/setting_handle/get_super';
            $modify_uri = 'ajax/setting_handle/modify_super';
        }
        $this->load->vars( 'get_uri', site_url( $get_uri ) );
        $this->load->vars( 'modify_uri', site_url( $modify_uri ) );
        $this->load->vars( 'is_super', $this->is_super );
        $this->load->view( 'master:setting' );
    }
    function seo()
    {
        $this->load->view( 'master:seo' );
    }
    function info()
    {
        $this->load->model( 'category_model' );
        $this->load->vars( 'category', $this->category_model->get_info_category() );
        $this->load->view( 'master:info' );
    }
    function news()
    {
        $this->load->view( 'master:news' );
    }
    function product()
    {
        $this->load->view( 'master:product' );
    }
    function download()
    {
        $this->load->view( 'master:download' );
    }
    function guestbook()
    {
        $this->load->view( 'master:guestbook' );
    }
    function member()
    {
        $this->load->view( 'master:member' );
    }
    function question()
    {
        $this->load->view( 'master:' );
    }
    function log()
    {
        $uri = 'ajax/log_handle/operate_list';
        if ($this->is_super)
        {
            $uri = 'ajax/log_handle/operate_list_super';
        }
        $this->load->vars( 'list_url', site_url( $uri ) );
        $this->load->view( 'master:log' );
    }
    function permission()
    {
        $this->load->view( 'master:permission' );
    }
    function user()
    {
        $this->load->view( 'master:user' );
    }
    function backup()
    {
        $this->load->view( 'master:backup' );
    }
    function phpinfo()
    {
        phpinfo();
    }
    function help()
    {
        $this->load->view( 'master:help' );
    }
    function about()
    {
        $this->load->view( 'master:about' );
    }
    function login()
    {
        if (UserHelper::check_login( true ))
        {
            header( "location:" . site_url( "ui/index" ) );
            return;
        }
        $this->load->view( 'login' );
    }
}
